<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>$Title$</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
                <script>
                    $(function(){
                        $("#uname").blur(function(){
                            //1.接收输入的信息
                            var uname=$(this).val();
                            //2.发送ajax
                             $.ajax({
                                 url:"/checkname",
                                 type:"post",
                                 data:"username="+uname,
                                 dataType:"text",
                                 success:function(rs){
                                     $("#rs").html(rs);
                                 }
                             });
                            // $.get("/checkuname","username="+uname,function(rs){
                            //     $("#rs").html(rs);
                            // });

                        });

                    })
                </script>
    <style type="text/css">
        #rs{ color:red}
    </style>
</head>
<body>
<h1>注册</h1>
username:<input type="text" id="uname" ><span id="rs" ></span>
</body>
</html>